﻿
@{
     
}
<div class="bjui-pageContent">
    <table class="table table-bordered" id="datagrid-User@(Request.QueryString["_"])" data-toggle="datagrid"></table>
</div>
<script type="text/javascript">
    var userGrid@(Request.QueryString["_"]) = $('#datagrid-User@(Request.QueryString["_"])');
    userGrid@(Request.QueryString["_"]).datagrid({
        height: '100%',
        width: '100%',
        showToolbar: true,
        toolbarItem: 'refresh,add,edit,save,exportf,del',
        dataUrl: '/User/UserSearch',
        dataType: 'json',
        //editMode: { dialog: { width: 800, height: 250, mask: true, faicon: 'caret-right', icon: 'plus', title: "编辑", fresh: true } },
        editMode: "inline",
        editUrl: '/User/UserUpsert',
        afterSave: saveCallBack,
        delUrl: '/User/DelUser',
        delPK: 'ID',
        paging: { pageSize: 20, orders: 'ADDED asc' },
        inlineEditMult: false,
        filterThead: true,
        showCheckboxcol: true,
        linenumberAll: true,
        fieldSortable: true,
        columnFilter: true,
        showCheckboxcol: false,
        //toolbarCustom: initBtn,
        exportOption: { type: "file", options: { url: "/User/UserExport", fileName: '用户' } },
        columns: [
            { name: 'ID', align: 'center', width: 500, label: 'ID', finalwidth: true, hide: true },
            { name: 'LOGINNAME', align: 'center', width: 120, label: '登录名' },
            { name: 'PASSWD', align: 'center', width: 120, label: '密码', render: function (value, data) { return '*******'; } },
            { name: 'REALNAME', align: 'center', width: 100, label: '真实名' },
            { name: 'NICKNAME', align: 'center', width: 120, label: '昵称' },
            { name: 'GENDER', align: 'center', width: 100, label: '性别', type: 'select', items: [{ '0': '男' }, { '1': '女' }] },
            { name: 'BIRTHDAY', align: 'center', width: 120, label: '生日' },
            { name: 'PHONE', align: 'center', width: 150, label: '电话' },
            { name: 'QQ', align: 'center', width: 120, label: 'QQ' },
            { name: 'EMAIL', align: 'center', width: 280, label: 'E-Mail' },
            { name: 'WECHAT', align: 'center', width: 120, label: '微信' },
            { name: 'STATE', align: 'center', width: 120, label: '状态', type: 'select', items: [{ '0': '启用' }, { '1': '禁用' }] },
            { name: 'ADDED', align: 'center', width: 120, label: '添加时间', type: 'date', pattern: 'yyyy-MM-dd HH:mm', add: false, edit: false },
            { name: 'LASTMODIFIED', align: 'center', width: 120, label: '最后修改时间', type: 'date', pattern: 'yyyy-MM-dd HH:mm', add: false, edit: false },
        ]
    });

    function refreshGri() {
        userGrid@(Request.QueryString["_"]).datagrid('filter', {});
        //userGrid@(Request.QueryString["_"]).datagrid('filter', { "clearOldPostData": true });
    }
    function initBtn() {
        return $("<button type='button' class='btn-default btn' onclick='refreshGri()'>清空查询</button>");
    }

    function saveCallBack($trs, datas) {
        userGrid@(Request.QueryString["_"]).datagrid('refresh', false);
    }

</script>
